import QtQuick 1.0

Rectangle {
    id: nodeItem
    width: 20
    height: 20
    color:  "#90999999"
    border.color: "black"
    radius: 5;

    property int key

    signal rightClick(int key)
    signal leftClick(int key)

    MouseArea {
        id: itemMouseArea
        anchors.fill: nodeItem
        acceptedButtons: Qt.LeftButton | Qt.RightButton

        onClicked:
        {
            switch ( mouse.button )
            {
            case Qt.RightButton:
                nodeItem.rightClick(key);
                break;
            case Qt.LeftButton:
                nodeItem.leftClick(key);
                break;
            }
        }
    }

    Text {
        id: keyText
        text: nodeItem.key
        anchors.centerIn: parent
    }
}
